package com.zheng.damo01.作业;

import java.util.Scanner;

public class Test07 {
    public static void main(String[] args) {
        System.out.println("请输入密码");
        String str=new Scanner(System.in).nextLine();
        System.out.print(str+"是否合法");
        System.out.println((str.length()>=9)&&charBigTow(str)&&numberExit(str));

    }
    public static boolean charBigTow(String str){
        char[] chars=str.toCharArray();
        int count=0;
        for (int i = 0; i < chars.length; i++) {
            if (chars[i]>='A'&&chars[i]<='Z'){
                count++;
            }
        }
        return count>=2;
    }
    public static boolean numberExit(String str){
        char[] chars=str.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i]>'0'&&chars[i]<'9'){
                return true;
            }
        }
        return false;
    }
}
